<%@ page language="java" contentType="text/html;charset=utf-8" %>
<!DOCTYPE HTML>
  <head>
    <script src="assets/plugins/ueditor/ueditor.config.js"></script>
    <script src="assets/plugins/ueditor/ueditor.all.min.js"></script>
    <script src="assets/plugins/jquery-1.10.2.min.js"></script>
    
  </head>
  <body>
     
    <script type="text/plain" id="j_ueditorupload" style="height:5px;display:none;" ></script>
    <script>
    
      //实例化编辑器
      var o_ueditorupload = UE.getEditor('j_ueditorupload',{
        autoHeightEnabled:false
      });
      o_ueditorupload.ready(function ()  {
    	o_ueditorupload.hide();//隐藏编辑器
	    //监听图片上传
	    o_ueditorupload.addListener('beforeInsertImage', function (t,arg){
// 	      alert('这是图片地址：'+arg[0].src);
		for(var i in arg){
			$('#imgshow').append("<img src='"+arg[i].src+"'/>");
// 			$('#imgshow').append(rpath+arg[i].src+"<br/>");
		}
	  });
     
	    /* 文件上传监听
	     * 需要在ueditor.all.min.js文件中找到
	     * d.execCommand("insertHtml",l)
	     * 之后插入d.fireEvent('afterUpfile',b)
	     */
       o_ueditorupload.addListener('afterUpfile', function (t, arg) {
          alert('这是文件地址：'+arg[0].url);
        });
      });
       
      //弹出图片上传的对话框
      function upImage()
      {
        var myImage = o_ueditorupload.getDialog("insertimage");
        myImage.open();
      }
      //弹出文件上传的对话框
      function upFiles()
      {
        var myFiles = o_ueditorupload.getDialog("attachment");
        myFiles.open();
      } 
    </script>
     
    <button type="button" onClick="upImage()">调用上传图片模块</button>
    <div id="imgshow"></div>
    <br>
    <button type="button" onClick="upFiles()">调用上传文件模块</button>
     
  </body>
<html>